<?php
session_start();
class Admin{

	function connect(){
		$user="root";
		$password="";
		$database="whitehouse";
		mysql_connect(localhost,$user,$password);
		@mysql_select_db($database) or die( "Unable to select database");
	}
	function isValidAdminLogin($loginDetails){
		$unit = $loginDetails['username'];
		$result = mysql_query("SELECT password FROM admin where username = '$unit'")
		or die(mysql_error()); 
		$row = mysql_fetch_array( $result );
		if(base64_decode($row['password']) == $loginDetails['password']){
			return true;
		}
	}
	function setPassword($new){
		$update = "UPDATE admin SET password = '$new'";
		mysql_query($update);
	}
	function getEmail(){
		$result = mysql_query("SELECT email FROM admin")
		or die(mysql_error()); 
		$row = mysql_fetch_array( $result );
		return $row['email'];
	}
	
	function getPassword(){
		$result = mysql_query("SELECT password FROM admin")
		or die(mysql_error()); 
		$row = mysql_fetch_array( $result );
		return base64_decode($row['password']);
	}
	

	
	

}
?>